<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>专业信息</title>
<link rel="stylesheet" href="resources/layui/css/layui.css">
</head>
<body>
<div class="demoTable">
  查询课程：
  <div class="layui-inline">
    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
  </div>
  <button class="layui-btn" data-type="reload">搜索</button>
</div>
<table class="layui-table" lay-data="{height: 'full-200', cellMinWidth: 80, page: true, limit:10,url:'resources/json/course.json', id:'demo',toolbar: '#toolbarDemo',defaultToolbar: ['filter', 'exports', 'print']}" lay-filter="demo">
 <thead>
    <tr>
      <th lay-data="{field:'cno', align:'center',sort:true}">课程号</th>
      <th lay-data="{field:'cName',align:'center'}">课程名</th>
      <th lay-data="{field:'tno',align:'center'}">教师编号</th>
      <th lay-data="{field:'mn',align:'center'}">最大选课人数</th>
      <th lay-data="{field:'cn',align:'center'}">选课人数</th>
      <th lay-data="{fixed: 'right', align:'center', toolbar: '#barDemo'}"></th>
    </tr>
  </thead>
</table> 
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">选择</a>
</script>
 <script src="resources/layui/layui.js"></script>
<script>
layui.use('table', function(){
    var table = layui.table;
  //监听工具条
    table.on('tool(demo)', function(obj){
      var data = obj.data;
      if(obj.event === 'select'){
        layer.confirm('确认选择', function(index){
          obj.del();
          layer.close(index);
        });
      }
    });
})
  


</script>
</body>
</html>
